<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Magic 口碑营销平台</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" href="../css/magic.css">
</head>
<body>
<div id="wrap">
  <form id="validate">
    <h2 class="title">新增业务</h2>
    <table>
      <tbody>
        <tr>
          <th><abbr title="必填项" class="require">*</abbr><label for="workname">业务名称：</label></th>
          <td><input type="text" name="workname" class="text s-size" id="workname"></td>
        </tr>
        <tr>
          <th><abbr title="必填项" class="require">*</abbr><label>业务层级：</label></th>
          <td><label><input type="radio" name="worklevel" id="worklevelfather">主业务</label> <label><input type="radio" name="worklevel" id="worklevelchild">子业务</label></td>
        </tr>
        <tr class="childset">
          <th><abbr title="必填项" class="require">*</abbr><label>业务类型：</label></th>
          <td><label><input type="radio" name="worktype">积分</label> <label><input type="radio" name="worktype">金豆</label> <label><input type="radio" name="worktype">经验值</label></td>
        </tr>
        <tr class="childset">
          <th><abbr title="必填项" class="require">*</abbr><label for="workfather">父级业务：</label></th>
          <td><select name="workfather" id="workfather">
              <option value="">点评</option>
            </select></td>
        </tr>
        <tr class="childset">
          <th><abbr title="必填项" class="require">*</abbr><label for="opttype">操作类型：</label></th>
          <td><select name="opttype" id="opttype">
              <option value="">撤销</option>
            </select></td>
        </tr>
        <tr>
          <th><abbr title="必填项" class="require">*</abbr><label for="workdesc">备注：</label></th>
          <td><textarea name="workdesc" id="workdesc" class="s-size"></textarea></td>
        </tr>
        <tr>
          <th></th>
          <td><input type="submit" value="保存" class="btn">
            <button class="auto-close">关闭</button></td>
        </tr>
      </tbody>
    </table>
  </form>
</div>
<script charset="utf-8" src="../js/jquery.js"></script>
<script charset="utf-8" src="../js/jquery.validate.js"></script>
<script charset="utf-8" src="../js/auto.js"></script>
<script>
$().ready(function() {
		$("#validate").validate({
				rules: {
						workname: "required",
						workdesc: "required"
				},
				messages: {
						workname: "Please enter username",
						workdesc: "Please enter work desc"
				}
		});
		var childset = $(".childset"),
				worklevelchild = $("#worklevelchild"),
				worklevelfather = $("#worklevelfather");
		function check(){
				if(worklevelchild.attr("checked")){
						childset.css("display","");
				}else{
						childset.css("display","none");
				}
		}
		worklevelchild.click(function(){
				check();
		});
		worklevelfather.click(function(){
				check();
		});
		check();
});
</script>
</body>
</html>